<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="./../../lib/jquery-3.3.1.js"></script>
    <title>Document</title>
</head>
<body>
    <form action="">
        <p><input type="text" name="uname" placeholder="username"></p>
        <p><input type="password" name="upwd" placeholder="your password!"></p>
        <button>login</button><button type="reset">reset</button>
    </form>
</body>
</html>
<script>
   
    $(function(){
        $("form").on("submit",function(){
            $.ajax({
                url:"./login",
                type:"post",
                data:$(this).serialize()
            }).then(res=>{
                console.log(res);
                if(res.status==1){
                    location="../../admin/index";
                }
            })
            return false;
        })
    })

</script>